<?php global $theme; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php $theme->meta_title(); ?></title>
<?php $theme->hook('meta'); ?>
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/reset.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/defaults.css" type="text/css" media="screen, projection" />
<!--[if lt IE 8]><link rel="stylesheet" href="<?php echo THEMATER_URL; ?>/css/ie.css" type="text/css" media="screen, projection" /><![endif]-->

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen, projection" />
<?php if ( is_singular() ) { wp_enqueue_script( 'comment-reply' ); } ?>
<?php  wp_head(); ?>
<?php $theme->hook('head'); ?>
<!-- jQuery to handle language selection -->
<script type="text/javascript">
		jQuery(document).ready(function(){
			////////////////////////////////
			// Set the postion of the language box
			var pos = jQuery("#header").offset();
			var x = pos.left;
			var y = pos.top;
			var w = jQuery("#header").width();
			jQuery("#ln").css("left", x + w + 5.5);
			jQuery("#ln").css("top",18);
			jQuery("#ln").show();
			///////////////////////////////////////////
			// Handle the language button click
			/*
			jQuery('.translation-links li a').click(function() {
			 var lang = jQuery(this).data('lang');
			  var $frame = jQuery('.goog-te-menu-frame:first');
			  if (!$frame.size()) {
				alert("Error: Could not find Google translate frame.");
				return false;
			  }
			  $frame.contents().find('.goog-te-menu2-item span.text:contains('+lang+')').get(0).click();
			  return false;
			});
			*/
			///////////////////////////////////////////////////////
			//////////////////////////////////////////////////////
			
			jQuery('.translation-links li a').click(function(e) {
				e.preventDefault();
				var lang = jQuery(this).data('lang');
				jQuery('#google_translate_element select option').each(function(){
					if(jQuery(this).text().indexOf(lang) > -1) {
						jQuery(this).parent().val(jQuery(this).val());
						var container = document.getElementById('google_translate_element');
						var select = container.getElementsByTagName('select')[0];
						triggerHtmlEvent(select, 'change');
				}
			});
		});
			////////////////////////////////////////////////////
			// more language handler
			//jQuery("#less").hide();
			jQuery(".more-ln").click(function(){
				var h = jQuery(document).height() * 0.8;
				jQuery("#ln").css("height",h);
				jQuery("#more").hide();
			});
			jQuery(".less-ln").click(function(){
				jQuery("#more").show();
				jQuery("#ln").css("height",294);
			});
		});
		
		//trigger event for translation
		function triggerHtmlEvent(element, eventName) {
			var event;
			if(document.createEvent) {
				event = document.createEvent('HTMLEvents');
				event.initEvent(eventName, true, true);
				element.dispatchEvent(event);
			} else {
				event = document.createEventObject();
				event.eventType = eventName;
				element.fireEvent('on' + event.eventType, event);
			}
		}
		// end of trigger event for translation
</script>
<style type="text/css">
.ln
{
	position:absolute;
	border:0px solid #333;
	width:170px;
	height:294px;
	overflow:hidden;
}
.ln-title
{
	font-size:13px;
	color:green;
	font-family:arial;
	font-weight:bold;
	padding-bottom:9px;
	padding-left: 13px;
}
#google_translate_element{
	display:none;
}
.skiptranslate
{
	display:none;
}
.translation-links{
	border:0px solid red;
	padding:0;
	padding-left:12px;
	margin-bottom:0px;
}
.translation-links li
{
	list-style:none;
	display:inline;
	margin:2px 7px;
}
.more
{
	padding-top:5px;
	padding-left:19px;
}
.more-ln{
	text-decoration:none;
}
.flag{
	text-align:left;
}
</style>
</head>

<body <?php body_class(); ?>>
<?php $theme->hook('html_before'); ?>

<div id="container">
<!-- This is the language box -->
    <div class="ln" id="ln">
		<div class="ln-title">
			Select A Language
		</div>
		<div class="flag">
		<ul class="translation-links">
			<li><a href="#" class="english" data-lang="English" title="English"><img src="<?php echo site_url();?>/flags/48/uk.png"/></a></li>
			<li><a href="#" class="spanish" data-lang="Korean" title="Korean"><img src="<?php echo site_url();?>/flags/48/SKorea.png"/></a></li>
			<li><a href="#" class="vietnames" data-lang="Vietnamese" title="Vietnamese"><img src="<?php echo site_url();?>/flags/48/Vietnam.png"/></a></li>
			<li><a href="#" class="japanese" data-lang="Japanese" title="Japanese"><img src="<?php echo site_url();?>/flags/48/Japan.png"/></a></li>
			<li><a href="#" class="chinese" data-lang="Chinese" title="Chinese"><img src="<?php echo site_url();?>/flags/48/China.png"/></a></li>
			<li><a href="#" class="spanish" data-lang="Spanish" title="Spanish"><img src="<?php echo site_url();?>/flags/48/Spain.png"/></a></li>
			<li><a href="#" class="italian" data-lang="Italian" title="Italian"><img src="<?php echo site_url();?>/flags/48/Italy.png"/></a></li>
			<li><a href="#" class="russian" data-lang="Russian" title="Russian"><img src="<?php echo site_url();?>/flags/48/Russia.png"/></a></li>
			<li><a href="#" class="french" data-lang="French" title="French"><img src="<?php echo site_url();?>/flags/48/France.png"/></a></li>
			<li><a href="#" class="dutch" data-lang="Dutch" title="Dutch"><img src="<?php echo site_url();?>/flags/48/Netherlands.png"/></a></li>
		</ul>
		<div id="more" class="more">
			<a href="#" class="more-ln">Show more</a>
		</div>
		<ul class="translation-links">
			<li><a href="#" class="thai" data-lang="Thai" title="Thai"><img src="<?php echo site_url();?>/flags/48/Thailand.png"/></a></li>
			<li><a href="#" class="danish" data-lang="Danish" title="Danish"><img src="<?php echo site_url();?>/flags/48/Denmark.png"/></a></li>
			<li><a href="#" class="czech" data-lang="Czech" title="Czech"><img src="<?php echo site_url();?>/flags/48/CzechRepublic.png"/></a></li>
			<li><a href="#" class="croatian" data-lang="Croatian" title="Croatian"><img src="<?php echo site_url();?>/flags/48/Croatia.png"/></a></li>
			<li><a href="#" class="estonian" data-lang="Estonian" title="Estonian"><img src="<?php echo site_url();?>/flags/48/Estonia.png"/></a></li>
			<li><a href="#" class="filipino" data-lang="Filipino" title="Filipino"><img src="<?php echo site_url();?>/flags/48/Philippines.png"/></a></li>
			<li><a href="#" class="finnish" data-lang="Finnish" title="Finnish"><img src="<?php echo site_url();?>/flags/48/Finland.png"/></a></li>
			<li><a href="#" class="german" data-lang="German" title="German"><img src="<?php echo site_url();?>/flags/48/Germany.png"/></a></li>
			<li><a href="#" class="hungarian" data-lang="Hungarian" title="Hungarian"><img src="<?php echo site_url();?>/flags/48/Hungary.png"/></a></li>
			<li><a href="#" class="indonesian" data-lang="Indonesian" title="Indonesian"><img src="<?php echo site_url();?>/flags/48/Indonezia.png"/></a></li>
			<li><a href="#" class="malay" data-lang="Malay" title="Malay"><img src="<?php echo site_url();?>/flags/48/Malaysia.png"/></a></li>
			<li><a href="#" class="norwegian" data-lang="Norwegian" title="Norwegian"><img src="<?php echo site_url();?>/flags/48/Norway.png"/></a></li>
			<li><a href="#" class="polish" data-lang="Polish" title="Polish"><img src="<?php echo site_url();?>/flags/48/Poland.png"/></a></li>
			<li><a href="#" class="portuguese" data-lang="Portuguese" title="Portuguese"><img src="<?php echo site_url();?>/flags/48/Portugal.png"/></a></li>
			<li><a href="#" class="turkish" data-lang="Turkish" title="Turkish"><img src="<?php echo site_url();?>/flags/48/Turkey.png"/></a></li>
			<li><a href="#" class="ukrainian" data-lang="Ukrainian" title="Ukrainian"><img src="<?php echo site_url();?>/flags/48/Ukraine.png"/></a></li>
			<li><a href="#" class="welsh" data-lang="Welsh" title="Welsh"><img src="<?php echo site_url();?>/flags/48/Wales.png"/></a></li>
			<li><a href="#" class="icelandic" data-lang="Icelandic" title="Icelandic"><img src="<?php echo site_url();?>/flags/48/Iceland.png"/></a></li>
			<li><a href="#" class="serbian" data-lang="Serbian" title="Serbian"><img src="<?php echo site_url();?>/flags/48/Serbia.png"/></a></li>
			<li><a href="#" class="slovak" data-lang="Slovak" title="Solvak"><img src="<?php echo site_url();?>/flags/48/Slovakia.png"/></a></li>
		</ul>
		<div id="less" class="more">
			<a href="#" class="less-ln">Show less</a>
		</div>
		</div>
	</div>
	<script type="text/javascript">
		jQuery("#ln").hide();
	</script>
<!-- The end of the language box -->
    <?php if($theme->display('menu_primary')) { ?>
        <div class="clearfix">
            <?php $theme->hook('menu_primary'); ?>
        </div>
    <?php } ?>
    <div id="header">
        <div id="top-search"> <?php get_search_form(); ?> </div>
        <div class="logo">
        <?php if ($theme->get_option('themater_logo_source') == 'image') { ?> 
            <a href="<?php echo home_url(); ?>"><img src="<?php $theme->option('logo'); ?>" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>" /></a>
        <?php } else { ?> 
            <?php if($theme->display('site_title')) { ?> 
                <h1 class="site_title"><a href="<?php echo home_url(); ?>"><?php $theme->option('site_title'); ?></a></h1>
            <?php } ?> 
            
            <?php if($theme->display('site_description')) { ?> 
                <h2 class="site_description"><?php $theme->option('site_description'); ?></h2>
            <?php } ?> 
        <?php } ?> 
        </div><!-- .logo -->
        
        <div class="header-right">
            <?php $theme->option('header_banner'); ?> 
        </div><!-- .header-right -->
        
    </div><!-- #header -->
    
    <?php if($theme->display('menu_secondary')) { ?>
        <div class="clearfix">
            <?php $theme->hook('menu_secondary'); ?>
        </div>
    <?php } ?>